<?php
	namespace core\lib;
	class config
	{
		static public $config = array();
		static public function get($name , $file)
		{
			if ( isset(self::$config[$file] ) ) {
				return self::$config[$file][$name];
			} else {
				$path = GOODCMS . '/core/config/' . $file . '.php';
				if ( is_file ( $path ) ) {
					$config = include $path;
					if ( isset( $config[$name] ) ) {
						self ::$config[ $file ] = $config;
						return $config[$name];
					} else {
						throw new \ErrorException( '没有这个配置项' . $name );
					}
				} else {
					throw new \ErrorException( '找不到配置文件' . $file );
				}
			}//end of first else
		}
		//返回所有数据

		static public function all($file){
			if (isset(self::$config[$file] )){
				return self::$config[$file];
			}else{
				$path = GOODCMS . '/core/config/' . $file . '.php';
				if (is_file( $path)){
					$config = include $path;
					self::$config[$file] = $config;
					return $config;
				}else{
					throw new \ErrorException('找不到配置文件'.$file);
				}
			}
		}
	}